package cn.itqiqi.student_system_java.controller;

import cn.itqiqi.student_system_java.pojo.Course;
import cn.itqiqi.student_system_java.service.impl.CourseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author kevin_琪琪
 * @version 1.0
 * @description
 * @date 2022-06-21 15:52
 */
@RestController
public class CourseController {

    @Autowired
    private CourseServiceImpl courseService;

    @GetMapping("/getCourseAllData")
    public String getCourseAll(Long pageNum, Long pageSize) {
        return courseService.getCourseAll(pageNum, pageSize);
    }

    @GetMapping("/getCourseByName")
    public String getCourseByName(Long pageNum, Long pageSize, String queryValue) {
        return courseService.getCourseByName(pageNum, pageSize, queryValue);
    }

    @PostMapping("/addCourse")
    public String addCourse(@RequestBody Course course) {
        return courseService.addCourse(course);
    }

    @PostMapping("/updateCourse")
    public String updateCourse(@RequestBody Course course) {
        return courseService.updateCourse(course);
    }

    @PostMapping("/deleteCourse")
    public String deleteCourse(@RequestBody Course course) {
        return courseService.deleteCourse(course);
    }

}
